<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: huajie <banhuajie@163.com>
// +----------------------------------------------------------------------

namespace Admin\Model;
use Think\Model;

/**
 * URL模型
 * @author huajie <banhuajie@163.com>
 */

class YwlbModel extends Model {
    //获取权限
    /*
    * 3、门店经理  4、获取客服 5、线下门市 6、线上经理 7、老板 8、线上门市
    */
    public function quanxian(){
        if(in_array(4,session('user_auth.group_id'))){
            $group  = 4;
        }
        if(in_array(3,session('user_auth.group_id'))){
            $group  = 3;
        }
        if(in_array(5,session('user_auth.group_id'))){
            $group  = 5;
        }
        if(in_array(6,session('user_auth.group_id'))){
            $group  = 6;
        }
        if(in_array(7,session('user_auth.group_id'))){
            $group  = 7;
        }
        if(in_array(8,session('user_auth.group_id'))){
            $group  = 8;
        }
        if(is_administrator()){
            $group  = 1;
        }
        return $group;
    }


    /**
    *业务状态，判断权限后
    */
    public function yw(){
        //获取权限
        $group = $this->quanxian();
        if($group == 4){
            $data['lb']     = array('in','33,63');
        }
        $data['status'] = array('eq',1);
        $data['lb']     = array('eq',3);
        $ywzt = $this->where($data)->field('uid,name')->order('sid')->select();
 
        return $ywzt;
    }
    /**
    *获取渠道
    */
    public function qd(){
        $newqdzt = $this->where(array('status'=>1,'lb'=>1))->order('sid')->field('uid,name')->select();
        return $newqdzt;
    }
    /**
    *获取类别
    */
    public function lb(){
        $newlb = $this->where(array('status'=>1,'lb'=>2))->order('sid')->field('uid,name')->select();
        return $newlb;
    }
	//支付方式
	public function zffs(){
		$newlb = $this->where(array('status'=>1,'lb'=>5))->order('sid')->field('uid,name')->select();
        return $newlb;
	} 
	//支付款项
	public function zfkx(){
		$newlb = $this->where(array('status'=>1,'lb'=>4))->order('sid')->field('uid,name')->select();
        return $newlb;
	} 
    //顾客标签
	public function gkbq(){
		$newlb = $this->where(array('status'=>1,'lb'=>6))->order('sid')->field('uid,name')->select();
        return $newlb;
	}    
}
